<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class MessController extends Controller
{
    //意见管理
    public function messshow(){
        $res = DB::table('mess')->paginate(1);
//       dd($res);
        return view('admin.message.message',['res'=>$res]);
    }
    //显示回复页面
    public function remess(){
        $id = $_GET['id'];
        $res = DB::table('mess')->where('id',$id)->get();
        return view('admin.message.remess',['res'=>$res]);
    }
    //执行回复操作
    public function remessage(Request $request){
        //dd($request->all());
        $id = $request->id;
        $remess = $request->remess;
        $flag = 1;
        $res = DB::table('mess')->where('id',$id)->update(['remess'=>$remess,'flag'=>$flag]);
//        dd($res);
        return redirect('admin/messs');
    }
}
